/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.yuecai.modules.yc_real_name.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.Instant;

/**
* @website https://el-admin.vip
* @description /
* @author dm
* @date 2020-06-23
**/
@Entity
@Data
@Table(name="yc_real_name")
public class YcRealName implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Long id;

    @Column(name = "user_id",nullable = false)
    @ApiModelProperty(value = "用户ID")
    private Long userId;

    @Column(name = "real_name",nullable = false)
    @NotBlank(message = "真实姓名不能为空")
    @ApiModelProperty(value = "真实姓名")
    private String realName;

    @Column(name = "identity_number",nullable = false)
    @NotBlank(message = "身份证号不能为空")
    @ApiModelProperty(value = "身份证号")
    private String identityNumber;

    @Column(name = "business_license",nullable = false)
    @NotBlank(message = "营业执照图片不能为空")
    @ApiModelProperty(value = "营业执照图片 多个用，拼接")
    private String businessLicense;

    @Column(name = "store_address",nullable = false)
    @NotBlank(message = "店铺地址不能为空")
    @ApiModelProperty(value = "店铺地址")
    private String storeAddress;

    @Column(name = "latitude",nullable = false)
    @NotBlank(message = "维度不能为空")
    @ApiModelProperty(value = "纬度")
    private String latitude;

    @Column(name = "longitude",nullable = false)
    @NotBlank(message = "经度不能为空")
    @ApiModelProperty(value = "经度")
    private String longitude;

    @Column(name = "create_time",nullable = false)
    @ApiModelProperty(value = "创建时间")
    private Instant createTime;

    @Column(name = "update_time",nullable = false)
    @ApiModelProperty(value = "修改时间")
    private Instant updateTime;

    public void copy(YcRealName source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}